import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
import { IsNotEmpty } from "class-validator";

export class CreateWorkDto {
    @ApiProperty({description: '项目名称'})
    @IsNotEmpty({message:'项目名称必填'})
    readonly name:string;

    @ApiProperty({description: '背景图片'})
    readonly bgImage:string;

    @ApiProperty({description: '项目描述'})
    readonly desc:string;

    @ApiProperty({description: '项目路径'})
    readonly path:string;

    @ApiProperty({description: '案例地址'})
    readonly link:string;

    @ApiProperty({description: 'git地址'})
    readonly git:string;

    @ApiProperty({description: '状态'})
    readonly status:number;

    @ApiProperty({description: '是否星标'})
    readonly hot:number;

    @ApiPropertyOptional({ description: '标签' })
    readonly tag: string;

    @ApiPropertyOptional({ description: '标签' })
    readonly startTime: Date;
  
    @ApiPropertyOptional({ description: '标签' })
    readonly endTime: Date;
}

export class UpdateWorkDto {
  @ApiProperty({description: '项目id'})
  @IsNotEmpty({message:'项目id必填'})
  readonly id:number;

  @ApiProperty({description: '项目名称'})
  @IsNotEmpty({message:'项目名称必填'})
  readonly name:string;

  @ApiProperty({description: '背景图片'})
  readonly bgImage:string;

  @ApiProperty({description: '项目描述'})
  readonly desc:string;

  @ApiProperty({description: '项目路径'})
  readonly path:string;

  @ApiProperty({description: '案例地址'})
  readonly link:string;

  @ApiProperty({description: 'git地址'})
  readonly git:string;

  @ApiProperty({description: '状态'})
  readonly status:number;

  @ApiProperty({description: '是否星标'})
  readonly hot:number;

  @ApiPropertyOptional({ description: '标签' })
  readonly tag: string;

  @ApiPropertyOptional({ description: '标签' })
  readonly startTime: Date;

  @ApiPropertyOptional({ description: '标签' })
  readonly endTime: Date;
}

export class WorksInfoDto {
    public id: number;
    public name: string;
    public bgImage: string;
    public desc: string;
    public path: string;
    public git: string;
    public link: string;
    public hot: number;
    public status: number;
    public worksTags: any[];
    public startTime:Date;
    public endTime:Date
  }
  
  export interface WorksRo {
    list: WorksInfoDto[];
    count: number;
  }